<template>
  <view class="my-page">
    <nav-custom :showSearch="false"></nav-custom>
    <map class="map" scale="9" latitude="28.600546" longitude="115.81823" :polygons="polygons"></map>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        polygons: []
      };
    },
    mounted() {
      this.getAddressInfo()
    },
    methods: {
      async getAddressInfo() {
        let res = await this.$H.get('/1.1/classes/map')
        const {
          deliveryRange
        } = res.data.results[0]
        const points = deliveryRange.map(point => {
          return {
            longitude: point[0],
            latitude: point[1],
          }
        })
        console.log('==== deliveryRange :', res, points);
        this.polygons = [{
            points: points,
            strokeWidth: 3,
            strokeColor: '#1791fc',
            zIndex: 11
          }]
        }
      }
    }
</script>

<style lang="scss" scoped>
  .map {
    width: 100%;
    height: 100vh;
  }
</style>
